home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-08-05 | 2.1 KB | 50 lines | [TEXT/MPS ] |
- DateThing
-
- A sample of how to write one of those date things as in the General control panel.
-
- This is a date thing, one of those things whereby a user can change the
- month, day, and year in one operation. This is written to allow the user
- to select a range of dates, but can be modified to adjust anything that has
- a range, like hours/minutes, degrees/seconds, feet/inches, and so on.
-
- All the code to do the date thing is in the file DateDialog.c, the other
- file is just support for the basic shell.
-
- Interesting bits;
-
- You can modify a number three ways in this sample
- 1) Hit the picture of the up or down arrow to move a number one position.
- If the user keeps holding down on the arrow, the number will continue to
- increase. I'm delaying 8 ticks between numeric increases (the traditional
- control-invert delay time), you may want to modify that. In products
- I usually make this variable, the longer the user holds down the faster the
- number will continue to change
-
- 2) Arrow keys
- Hittin the left or down arrow drops the selected number down one.
- Right and up increase the number one. Pretty boring.
-
- 3) Numeric input.
- If the user hits a number key, I replace the selected number with the number
- they have hit. This also allows multi-digit input, if the user hits
- two numbers rapidly (within 60 ticks of each other) then both numbers are
- entered. Y'Know, like if they hit 1 and 0 within 60 ticks of each other
- I interprete that as 10.
-
- Navigating is with the tab key to move between fields, or mouse clicks on a field.
-
- Notice that I am using the System (for the most part) to do any date validity
- checking and conversion. It's already in there, why re-write it?
-
- What else? I thought about making this a CDEF, and still might. I'm using
- a global to keep track of the dates in the dialog, you may want to put it
- somewhere else.
-
- One thing I'm NOT doing yet, that's looking at the international resources
- ('itl0' and 'itl1') to see what the user has set up as date ordering.
- Sorry.
-
- Enjoy, and report any bugs, if I don't know I can't fix.
-
- C.K. Haun <TR>
- Apple Developer Technical Support